package nz.ac.massey.groupproject.ecs2;

public strictfp class OrbitMotionSystem implements ECSSystem {

	// does not prevent going off screen.  After all, it's not gonna escape far.
	public void tick(Position pos, OrbitMotion m) {
		m.curAngle += m.rotRate;
		m.curAngle %= 360;    // could be -359 to +359

		double rad = m.curAngle * StrictMath.PI / 180.0;
		pos.x  =  m.cx  + (int) StrictMath.round(m.r *  StrictMath.cos(rad));
		pos.y  =  m.cy  + (int) StrictMath.round(m.r *  StrictMath.sin(rad));
	}
}
